Sub 生成随机数据()
    Dim iLoop
Application.ScreenUpdating = False
    For iLoop = 1 To 60000
        Cells(iLoop, 1) = Rnd
    Next iLoop
    Application.ScreenUpdating = True
End Sub


Sub testBinarySortTree()
    Dim t#
    t = Timer
    Dim myTree() As New BinaryTreeItem
    Dim rng As Range
    Dim myArr() As Variant
    Dim oa As New OperationArray
    Dim bstTree As BinarySortTree
    
    Dim i As Integer
    
    '初始化结点数据
    Set rng = [a1:A40000]
    myArr = rng
    myArr = oa.dimensionExtraction(myArr)
    ReDim myTree(UBound(myArr) - LBound(myArr))
    
    For i = LBound(myArr) To UBound(myArr)
        
        myTree(i - 1).Value = myArr(i)
        
        Set myTree(i - 1).LeftChild = Nothing
        
        Set myTree(i - 1).RightChild = Nothing
        
    Next i
    
    Set bstTree = New BinarySortTree
    
    '创建排序二叉树
    
    bstTree.CreateBinarySortTree myTree
    
    '输出结果
    
    bstTree.WalkInorder
    

    Debug.Print Format(Timer - t, "0.000") & " Seconds"
    
End Sub
